package com.example.demo.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    @RequestMapping()
    public String index(){
        return "login";
    }

    @RequestMapping("login")
    public String login(String username, String password,
                        Model model){
        //登陆验证
        if(!StringUtils.isEmpty(username) && "123456".equals(password)){
            return "index";
        }
        else{
            model.addAttribute("msg","用户名或者密码错误");
            return "login";
        }

    }

    @RequestMapping("html/index")
    public String home(){
        return "html/index";
    }
}
